import tkinter as tk
from tkinter import filedialog, messagebox

from ..utils.logger import logger
from .about_dialog import AboutDialog


class MenuManager:
    """菜单管理功能"""

    def _create_menu(self):
        """创建菜单"""
        menubar = tk.Menu(self.window)
        self.window.config(menu=menubar)

        # 文件菜单
        file_menu = tk.Menu(menubar, tearoff=0)
        menubar.add_cascade(label="文件", menu=file_menu)
        file_menu.add_command(label="退出", command=self._on_closing)

        # 帮助菜单
        help_menu = tk.Menu(menubar, tearoff=0)
        menubar.add_cascade(label="帮助", menu=help_menu)
        help_menu.add_command(label="常见问题", command=self._show_faq)
        help_menu.add_command(label="关于", command=self._show_about)

    def _show_about(self):
        """显示关于对话框"""
        AboutDialog(self.window)

    def _show_faq(self):
        """显示常见问题对话框"""
        from .faq_dialog import FAQDialog

        FAQDialog(self.window)
